#include <stdio.h>
#include "opt.h"
#include "sub.h"
#include "selector.h"

int main(int argc, const char *const *argv)
{
	const struct subinfo *sub;
	int ind;

	ind = 0;
	sub = find_sub(argv[0]);
	if (sub->name == 0 && argc >= 2) {
		sub = find_sub(argv[1]);
		if (sub->main != default_main)
			ind = 1;
	}

	return sub->main(argc - ind, &argv[ind]);
}
